package com.ruoyi.system.service.impl;
import com.ruoyi.system.entity.PreventionPlanPerformance;
import com.ruoyi.system.mapper.PreventionPlanPerformanceMapper;
import com.ruoyi.system.service.PreventionPlanPerformanceService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 隐患排查计划完成情况 服务实现类
 * </p>
 * @author liushuai
 * @since 2023-03-09
 */
@Service("preventionPlanPerformanceService")
public class PreventionPlanPerformanceServiceImpl implements PreventionPlanPerformanceService {

    @Resource
    private PreventionPlanPerformanceMapper preventionPlanPerformanceMapper;


    @Override
    public List<PreventionPlanPerformance> queryByPage(PreventionPlanPerformance preventionPlanPerformance) {
        return preventionPlanPerformanceMapper.queryAllByLimit(preventionPlanPerformance);
    }

    @Override
    public PreventionPlanPerformance queryById(Integer id) {
        return this.preventionPlanPerformanceMapper.queryById(id);
    }

    @Override
    public PreventionPlanPerformance insert(PreventionPlanPerformance preventionPlanPerformance) {
        /*preventionPlanPerformance.setInitiatorId(SecurityUtils.getUserId().intValue());
        preventionPlanPerformance.setInitiatorName(SecurityUtils.getUsername());*/
        this.preventionPlanPerformanceMapper.insert(preventionPlanPerformance);
        return preventionPlanPerformance;
    }

    @Override
    public PreventionPlanPerformance update(PreventionPlanPerformance preventionPlanPerformance) {
        this.preventionPlanPerformanceMapper.update(preventionPlanPerformance);
        return this.queryById(preventionPlanPerformance.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return this.preventionPlanPerformanceMapper.deleteById(id) > 0;
    }
}
